[pull] master from flameshot-org:master - #273
Merged
Merged
Conversation
Pinning a capture on a display with 150% scaling produces a pin window half again as large as the region that was selected. #4614 fixed the position of that window for v14.0.0; this is the size. A capture started from the tray icon is fine, because the tray lives in the daemon and createPin() hands the pixmap straight to attachPin(). Any invocation that runs in its own process instead -- `flameshot gui` from a shell, a desktop or AutoHotkey shortcut, D-Bus -- finds FlameshotDaemon::instance() null and serializes the capture to the daemon. QDataStream writes a QPixmap as a plain image, which carries no device pixel ratio, so the daemon reconstructs a pixmap that claims a ratio of 1. PinWidget then lays out device pixels as if they were logical ones and the window comes out too large by the scale factor. The built-in PrintScreen hook is not affected; it runs inside the daemon and takes the in-process path. Send the ratio next to the pixmap so the serialized path ends up with the same pixmap the in-process path already gets. Both transports share the reading half, since the D-Bus adapter and the KDSingleApplication handler each deserialize the message themselves. A message from an older flameshot has no ratio appended; the read runs past the end, the stream reports it, and the pixmap keeps the ratio it already had. Checked on Windows 11, 1024x768 screen, QT_SCALE_FACTOR=1.5, pinning a 400x300 region. The pin window measured 621x471 before and 422x321 after. The capture is 400x300 device pixels either way, so the pin should be that plus the 7pt margin on each side, and the patched size matches the 414x314 measured on an unscaled screen to within the scaled margin. Unscaled displays measured 414x314 both before and after.
The GNOME clipboard workaround (keeping the capture window alive so Wayland can serve clipboard data after the window closes) was gated to GNOME only. COSMIC hits the exact same Wayland limitation but never triggered the workaround, so copy-to-clipboard silently did nothing on COSMIC. Extends the check to include COSMIC. Also fixes a race in the workaround itself: it previously closed the window on the first clipboard read of any kind, which could cut off a paste consumer that probes available clipboard types before issuing the real data fetch. It now closes only once the clipboard's current data is no longer ours, and the safety-net timeout is raised from 500ms to 30s, since COSMIC's compositor fetches clipboard data lazily (on actual paste) rather than eagerly grabbing it like GNOME's mutter does. Verified on Pop!_OS 24.04 with COSMIC 1.0.0.
* async-notification The previous synchronous callWithArgumentList stalled the main thread for the QtDBus reply timeout (~25s) after every capture, freezing further captures until it returned. Probably related to Issue #2425. * Fix missing closing curly brace * clang-format --------- Co-authored-by: Mehrad Mahmoudian <m.mahmoudian@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )